<template>
    <div class="mui-numbox" data-numbox-min='1'>
        <button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
        <input @change="getCount_child" ref="count_child" id="test" class="mui-input-numbox" type="number" value="1" />
        <button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
    </div>
</template>
<script>
import mui from '../../lib/mui/js/mui.js'
export default {
    methods:{
        getCount_child:function () {
        //把numbox里的值用参数赋值的形式传给父组件
        this.$emit('getCount',parseInt(this.$refs.count_child.value));
    },
    },
    mounted:function () {
        mui('.mui-numbox').numbox();
    },
    props:['remain'],
    watch:{
        remain:function (newValue, oldValue) {
            mui('.mui-numbox').numbox().setOption('max',newValue);
        }
    }
}
</script>